import axios from "@/utils/request";
import Vue from "vue";

const Api = {
    getAllItem: "/admin/item",
    addItem: "/admin/itemAdd",
    itemChange: "/admin/itemChange",
    deleteItem: "/admin/item",
    queryItem: "/admin/query-item",
    categoryAdd: "/admin/categoryAdd",
    deleteCategory: "/admin/category",
    categoryChange: "/admin/categoryChange",
    photoChange: "/admin/photoChange",
  };

  export function getAllItem() {
    return axios({
      url: Api.getAllItem,
      method: "get",
    });
  }

  export function addItem(parameter) {
    return axios({
      url: Api.addItem,
      method: "post",
      data:parameter,
    });
  }

  export function itemChange(parameter) {
    return axios({
      url: Api.itemChange,
      method: "put",
      data: parameter,
    });
  }

  export function deleteItem(parameter) {
    return axios({
      url: Api.deleteItem,
      method: "delete",
      params:parameter,
    });
  }
  
  export function queryItem(parameter) {
    return axios({
      url: Api.queryItem,
      method: "get",
      params:parameter,
    });
  }
  
  export function categoryAdd(parameter) {
    return axios({
      url: Api.categoryAdd,
      method: "post",
      data:parameter,
    });
  }
  
  export function deleteCategory(parameter) {
    return axios({
      url: Api.deleteCategory,
      method: "delete",
      params:parameter,
    });
  }
  
  export function categoryChange(parameter) {
    return axios({
      url: Api.categoryChange,
      method: "put",
      data:parameter,
    });
  }
  
  export function photoChange(parameter) {
    return axios({
      url: Api.photoChange,
      method: "post",
      data:parameter,
    });
  }